package tt.com.financialmanagement.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import tt.com.common.model.DriveTask;
import tt.com.common.model.Order;

import tt.com.financialmanagement.mapper.DriveTasksMappers;
import tt.com.financialmanagement.service.DriveTaskService;

import java.util.List;

@Service
public class DriveTaskServiceImpl extends ServiceImpl<DriveTasksMappers, DriveTask> implements DriveTaskService {

    @Override
    public ResponseEntity selectDrive(Order order) {
        //判断是否存在该逝者
        QueryWrapper<DriveTask> wrapper = new QueryWrapper<>();
        wrapper.eq("dead_id",order.getDeadId());
        wrapper.eq("data_status",1);
        List<DriveTask> driveTasks = baseMapper.selectList(wrapper);
        if (driveTasks.size()<0){
            return new ResponseEntity("该信息不存在", HttpStatus.INTERNAL_SERVER_ERROR);
        }
        return new  ResponseEntity(driveTasks,HttpStatus.OK);
    }
}
